

import {Component, OnInit} from '@angular/core';
import {Router} from "@angular/router";
import {ProjectCategory} from "../entity/ProjectCategory";
import {CategoryFindService} from "../service/category.find.service";
@Component({
  selector: 'category-menu-left',
  templateUrl: './category-menu-left.html'
})
export class CategoryMenuLeftComponent implements OnInit{
  public categoryList:Array<ProjectCategory> = new Array<ProjectCategory>();
  ngOnInit(): void {
    //this.ShowLeftProgram();
    this.categoryFindService.findAllCategory().then(categorys=>
      this.categoryList=categorys);
  }
  constructor(private router: Router,private categoryFindService:CategoryFindService){

  }
  toCategoryNav(categoryId:string,index:string){
    sessionStorage.setItem("indexOne",index);
    // this.router.navigate(['/category',categoryId]);
    this.router.navigate(['/category',{id:categoryId+"", pageNo: 0,indexOne:index}]);
    let width = document.body.clientWidth;
    console.log("width:"+width);
    console.log("width<450"+(width<450));
    if(width<450){
       // document.getElementById("nav").style.display="none !important;";
      console.log("display:none");
      $("#nav").css("display","none");
      $("#category-child-list").css("display","");
    }

    // this.testScreen();
  }
  public testScreen(){
    console.log(
      "屏幕分辨率为："+screen.width+"*"+screen.height
      +"<br />"+
      "屏幕可用大小："+screen.availWidth+"*"+screen.availHeight
      +"<br />"+
      "网页可见区域宽："+document.body.clientWidth
      +"<br />"+
      "网页可见区域高："+document.body.clientHeight
      +"<br />"+
      "网页可见区域宽(包括边线的宽)："+document.body.offsetWidth
      +"<br />"+
      "网页可见区域高(包括边线的宽)："+document.body.offsetHeight
      +"<br />"+
      "网页正文全文宽："+document.body.scrollWidth
      +"<br />"+
      "网页正文全文高："+document.body.scrollHeight
      +"<br />"+
      "网页被卷去的高："+document.body.scrollTop
      +"<br />"+
      "网页被卷去的左："+document.body.scrollLeft
      +"<br />"+
      "网页正文部分上："+window.screenTop
      +"<br />"+
      "网页正文部分左："+window.screenLeft
      +"<br />"+
      "屏幕分辨率的高："+window.screen.height
      +"<br />"+
      "屏幕分辨率的宽："+window.screen.width
      +"<br />"+
      "屏幕可用工作区高度："+window.screen.availHeight
      +"<br />"+
      "屏幕可用工作区宽度："+window.screen.availWidth
    );
  }

}


